// API 配置
export const API_CONFIG = {
  // Moonshot API 配置
  MOONSHOT: {
    BASE_URL: 'https://api.moonshot.cn',
    // 请在这里直接设置你的 API 密钥，或者设置环境变量 VITE_MOONSHOT_API_KEY
    API_KEY: import.meta.env.VITE_MOONSHOT_API_KEY || 'sk-UZr1pGehZlVSBzEb65JyBdLVR5YYahr4DaAohDGUUYAQwTxI',
    DEFAULT_MODEL: 'moonshot-v1-8k',
    DEFAULT_TEMPERATURE: 0.7,
    DEFAULT_MAX_TOKENS: 1000,
  },
  
  // 支付宝支付配置
  ALIPAY: {
    APP_ID: import.meta.env.VITE_ALIPAY_APP_ID || '2021001234567890',
    GATEWAY_URL: 'https://openapi.alipay.com/gateway.do',
    PRIVATE_KEY: import.meta.env.VITE_ALIPAY_PRIVATE_KEY || '',
    PUBLIC_KEY: import.meta.env.VITE_ALIPAY_PUBLIC_KEY || 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwGFZtwMX6eB+KnHQ39xFHa/w1h/wloyr86VNHyo5XcwVr0Tj2PqCfT9ja9sbk2YfSklcGXNYnceTD2eITIM3kr0N4hW2oS81gjnsSlrFwoML+VDzd5xHn6fcsjlR7ZTjvJdBxQo3f0PBl5bmQqPa1V2yGcvgPuzLkhKba32JYyiMjt6LiZQ3lN9c1axfDNyKCqm7+RxrqFvMjGUGQZXpsSo1KK14mOk7BcuRjI5oIDgVrRv9xmwsI8EVdZTOzUAhS+WO0OjUBcxZdUsmN7s/zoMbf4GVE3YZpERsDP14Gu5PBHlgtiV0b6gk3SgWP9sJxpBr/3JoHkrrzQ1U6JhdKQIDAQAB',
    NOTIFY_URL: import.meta.env.VITE_ALIPAY_NOTIFY_URL || '/api/alipay/notify',
    RETURN_URL: import.meta.env.VITE_ALIPAY_RETURN_URL || '/api/alipay/return',
  },
  
  // 其他API配置
  BASE_URL: import.meta.env.VITE_API_BASE_URL || '/api',
  TIMEOUT: 30000,
};

// 检查API密钥是否配置
export const checkApiKey = () => {
  const apiKey = API_CONFIG.MOONSHOT.API_KEY;
  if (!apiKey || apiKey === 'sk-your-api-key-here') {
    console.warn('⚠️ Moonshot API密钥未配置,请设置 VITE_MOONSHOT_API_KEY 环境变量');
    return false;
  }
  return true;
};

// 获取API密钥
export const getApiKey = () => {
  return API_CONFIG.MOONSHOT.API_KEY;
};
